home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_class_grenade.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  86 lines

  1. # Jones 3D Cog Script
  2. #
  3. # class_Grenade.cog
  4. #
  5. # Splash generator for grenades and satchels.
  6. #
  7. # [RT]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     
  14.     message        splash
  15.  
  16.     material    mat=gen_a4sfx_splash.mat    local
  17.  
  18.     template    tpl_Splash=splashenter        local
  19.     template    tpl_Spray=+spray            local
  20.     template    tpl_Ripple=+ripples            local
  21.  
  22.     thing        grenade                        local
  23.     thing        newThing                    local
  24.  
  25.     sector        createSec                    local
  26.     vector        createPos                    local
  27.  
  28. # ************************ SUBROUTINES *************************
  29.  
  30.     flex        SplashGenerator                local
  31.     flex        RippleGenerator                local
  32.  
  33. end
  34.  
  35. # ........................................................................................
  36.  
  37. code
  38.  
  39. splash:
  40.  
  41.     if (GetSourceRef() != 1) return; # Check for enter water
  42.  
  43.     grenade = GetSenderRef();
  44.  
  45.     createSec = GetThingSector(grenade);
  46.     createPos = GetThingPos(grenade);
  47.  
  48.     call SplashGenerator;
  49.     Sleep(0.4);
  50.     call RippleGenerator;
  51.  
  52.     return;
  53.  
  54. # -------------------------------------------------------------------
  55.  
  56. SplashGenerator: # Assumes createSec & createPos are already set...
  57.  
  58.     # Make a splash...
  59.     CreateThingAtPos(tpl_Splash, createSec, createPos, '0 0 0');
  60.     MaterialAnim(mat, 12.0, 0x0);
  61.  
  62.     # ...and some spray
  63.     newThing = CreateThingAtPos(tpl_Spray, createSec, createPos, '0 0 0');
  64.     SetThingFlags(newThing, 0x8000000);
  65.  
  66.     return;
  67.  
  68. # -------------------------------------------------------------------
  69.  
  70. RippleGenerator: # Assumes createSec & createPos are already set...
  71.  
  72.     # Make some ripples
  73.     newThing = CreateThingAtPos(tpl_Ripple, createSec, VectorAdd(createPos, '0.02 0.0 0.0'), '0 0 0');
  74.     AnimateSpriteSize(newThing, '0.28 0.28 1.0', '0.5 0.5 0.0', 0.5);
  75.     newThing = CreateThingAtPos(tpl_Ripple, createSec, VectorAdd(createPos, '-0.02 0.0 0.0'), '0 0 0');
  76.     AnimateSpriteSize(newThing, '0.28 0.28 1.0', '0.4 0.4 0.0', 0.5);
  77.     newThing = CreateThingAtPos(tpl_Ripple, createSec, VectorAdd(createPos, '0.0 0.02 0.0'), '0 0 0');
  78.     AnimateSpriteSize(newThing, '0.28 0.28 1.0', '0.4 0.4 0.0', 0.5);
  79.     newThing = CreateThingAtPos(tpl_Ripple, createSec, VectorAdd(createPos, '0.0 -0.02 0.0'), '0 0 0');
  80.     AnimateSpriteSize(newThing, '0.28 0.28 1.0', '0.4 0.4 0.0', 0.5);
  81.  
  82.     return;
  83.  
  84. end
  85.  
  86.